package com.service.impl;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;

import com.model.Product;
import com.util.ReadXlsUtil;

public class ProductXls {
	private static Product product = null;

	public static Product read(HSSFRow hssfRow) {
		product = new Product();
		HSSFCell no = hssfRow.getCell(0);
		HSSFCell name = hssfRow.getCell(1);
		HSSFCell price = hssfRow.getCell(2);
		HSSFCell desc = hssfRow.getCell(3);
		HSSFCell productTyle_Id = hssfRow.getCell(4);
		product.setProductNo(ReadXlsUtil.getValue(no));
		product.setProductName(ReadXlsUtil.getValue(name));
		product.setDescription(ReadXlsUtil.getValue(desc));
		product.setPrice(Double.parseDouble(ReadXlsUtil.getValue(price)));
		product.setProductType_Id(Integer.parseInt(ReadXlsUtil
				.getValue(productTyle_Id)));
		return product;
	}
}
